package eteam.aps.gateway.client;

import eteam.aps.common.R;
import eteam.aps.common.exceptions.AuthException;
import eteam.aps.systeminterface.model.reqparam.ResetPwdParam;
import eteam.aps.systeminterface.service.IAuthController;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * feign声明式接口。发起远程调用的。
 * 1. 定义接口
 * 2. 接口上添加注解 @FeignClient,设置value属性为 服务提供者的 应用名称
 * 3. 编写调用接口，接口的声明规则 和 提供方接口保持一致。
 * 4. 注入该接口对象，调用接口方法完成远程调用
 */
@FeignClient(value = "systemservice", url = "${gateway.system-url}")
//@FeignClient(value = "systemservice", url = "#{@getSystemUrl}")
//@FeignClient(value = "systemservice")
public interface SystemAuthFeignClient extends IAuthController {
    @GetMapping("/api/getnow")
    R<String> getNow();

    @RequestMapping(value = "/api/getnow01", method = RequestMethod.GET)
    R<String> getNow01(@RequestParam("p") String a);

    @RequestMapping(value = "/api/postinfo", method = RequestMethod.POST)
    R<String> postInfo(@RequestBody ResetPwdParam a);

    /**
     * 获取当前用户的权限Key列表
     *
     * @return: 权限列表
     */
    @RequestMapping(value = "/api/auth/getuclist", method = RequestMethod.GET)
    R<List<String>> getUcList(@RequestHeader("token") String token) throws Exception, AuthException;
}